﻿using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Windows.ApplicationModel.Resources;
using FunstreamTV.Annotations;
using FunstreamTV.Model;
using FunstreamTV.Model.User;
using FunstreamTV.Tools;

namespace FunstreamTV.ViewModel
{
    public class BaseViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        [NotifyPropertyChangedInvocator]
        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        public static string GetString(string resourceKey)
        {
            return new ResourceLoader().GetString(resourceKey);
        }

        public static async Task<LoginResponse> GetUser()
        {
            return await FileManager.Load<LoginResponse>("LoginResponse");
        }

        public const string ServerUrl = "http://funstream.tv";
    }
}
